package Frame;

import javax.swing.*;
import java.awt.*;

public class FrameWithButtons {
    public static void main(String[] args) {
        JFrame frame = new JFrame("网状布局DEMO");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(300,300);
        //使用网络布局
        frame.setLayout(new GridLayout(5,4));
        for (int i = 0; i < 20; i++) {
            JButton jButton =new JButton(String.valueOf(i));
            frame.add(jButton);
        }
        frame.setVisible(true);
    }
}
